# -*- encoding:utf8 -*-

class Parent:   # 定义父类
    "父类"
    parentAttr = 100
    def __init__(self):
        print "父类的构造方法"

    def parentMethod(self):
        print "父类方法"

    def setAttr(self,parentAttr):
        self.parentAttr = parentAttr

    def getAttr(self):
        print "父类属性:",self.parentAttr

    def __del__(self):
        print "父类析构方法"


class Child(Parent):    # 定义子类
    "子类"

    def __init__(self):
        print "子类构造方法"

    def childMethod(self):
        print "子类方法"

    def __del__(self):
        print "子类析构方法"


child = Child()
child.childMethod()
child.parentMethod()
child.setAttr(200)
child.getAttr()

print issubclass(Child,Parent)
print issubclass(Parent,Child)
print isinstance(child,Parent)
print isinstance(child,Child)

del child

